# result 方法：获取返回值(按照顺序，阻塞返回(任务不阻塞，返回值阻塞))

import time
from concurrent.futures import ThreadPoolExecutor


def eat(name):
    print(f'{name} is eating')
    time.sleep(10 - name)
    print(f'{name} is done')
    return f"{name} 's result"


if __name__ == '__main__':
    with ThreadPoolExecutor(max_workers=5) as executor:
        req = [executor.submit(eat, name) for name in range(10)]
        print(list(i.result() for i in req)) # 打印出来的严格按照顺序进行
